##############################################################################
# Looks for the JOST library installation and defines:
#
#  JOST_FOUND - system has JOST.
#  JOST_INCLUDE_DIRS - the JOST include directory.
#  JOST_LIBRARIES - Link these to use JOST.
#
# You need the environment variable $SIMD_INSTALL_DIR to be set to your JOST
# installation directory.
##############################################################################

FIND_PATH(JOST_INCLUDE_DIR
	NAMES
		jost/jost.hpp
	PATHS
		$ENV{JOST_INSTALL_DIR}/include
)

IF (JOST_INCLUDE_DIR)
	MESSAGE(STATUS "Found JOST include dir: ${JOST_INCLUDE_DIR}")
ELSE (JOST_INCLUDE_DIR)
  MESSAGE(FATAL_ERROR "Could not find JOST include dir")
ENDIF (JOST_INCLUDE_DIR)

SET(JOST_INCLUDE_DIRS 
	${JOST_INCLUDE_DIR} 
)

# Find libraries
FIND_LIBRARY(JOST_LIBRARY
	NAMES
		JOST
	PATHS
		$ENV{JOST_INSTALL_DIR}/lib
)

SET(JOST_LIBRARIES
		${JOST_LIBRARY}
)


IF (JOST_INCLUDE_DIRS AND JOST_LIBRARIES)
	SET(JOST_FOUND TRUE)
ENDIF (JOST_INCLUDE_DIRS AND JOST_LIBRARIES)

IF (JOST_FOUND)
	MESSAGE(STATUS "Found JOST C++ libraries: ${JOST_LIBRARIES}")
ELSE (JOST_FOUND)
	IF (JOST_FIND_REQUIRED)
		MESSAGE(FATAL_ERROR "Could not find JOST")
	ENDIF (JOST_FIND_REQUIRED)
ENDIF (JOST_FOUND)

MARK_AS_ADVANCED(JOST_INCLUDE_DIRS JOST_LIBRARIES)

